c# tostring decimal 2 places

135

c# tostring decimal 2 places -

decimalVar.ToString("0.00"); // returns "0.50"  when decimalVar == 0.5m

c# tostring decimal 2 places -

decimalVar.ToString("0.##"); // returns "0.5"  when decimalVar == 0.5m

c# tostring decimal 2 places -

decimalVar.ToString("#.##"); // returns ".5" when decimalVar == 0.5m

Comments

Submit
0 Comments